package com.xzc.refactory.method.replaceTempWithQuery;

public class C5 {
    int _quantity;
    int _itemPrice;

    double getPrice() {
        //依次替换掉basePrice引用点，并最终删除这个临时变量
        final double discountFactor;
        if (basePrice() > 1000)
            discountFactor = 0.95;
        else
            discountFactor = 0.98;
        return basePrice() * discountFactor;
    }

    private int basePrice() {
        return _quantity * _itemPrice;
    }
}
